const Router = require('koa-router')
const { setUserAvatar, savePictureInfo } = require('../controller/file.controller')
const { verifyAuth } = require('../middleware/auth.middleware')
const { avatarHandler, pictureHandler, pictureResize } = require('../middleware/file.middleware')
const FileRouter = new Router({ prefix: '/upload' })

// 用户上传头像接口
FileRouter.post('/avatar', verifyAuth, avatarHandler, setUserAvatar)
// 用户上传图片接口
FileRouter.post('/picture', verifyAuth, pictureHandler, pictureResize, savePictureInfo)

module.exports = FileRouter
